#pragma once
#include "ZPackageBase.h"


class ZTCPNETLIB ZTcpPackReactor : public QObject			//
{
public:
	ZTcpPackReactor(void) {};
	virtual ~ZTcpPackReactor(void) {};

public:
	virtual void DealPackage(const ZPackageBase& pack, QTcpSocket* pDealSock) const = 0;
	virtual	const QString GetCarePackType() = 0;
};

class ZTCPNETLIB ZTcpPackReactorMgr
{
	typedef std::multimap<QString, ZTcpPackReactor*> ReactorMap;
public:
	ZTcpPackReactorMgr() {};
	~ZTcpPackReactorMgr();

public:
	void DealPackage(const ZPackageBase& pack, QTcpSocket* pDealSock) const;

public:
	void RegReactor(ZTcpPackReactor* pReactor);
	void UnRegReactor(ZTcpPackReactor* pReactor);
	void UnRegReactor(const QString& reactorType);

private:
	ReactorMap  m_reactorMap;
};